package homework;

import java.util.Scanner;

public class WaterNum_rangeAB {
	public static void main(String[] args) {
		 Scanner scanner = new Scanner(System.in);
	        // 获取起始范围
	        int a = scanner.nextInt();
	        // 获取终止范围
	        int b = scanner.nextInt();
	        // ---------------------Begin------------------------
	        boolean found = false;
	        // 确保 a 小于等于 b
	        int start = Math.min(a, b);
	        int end = Math.max(a, b);

	        for (int num = start; num <= end; num++) {
	            if (isNarcissistic(num)) {
	                System.out.println(num);
	                found = true;
	            }
	        }

	        if (!found) {
	            System.out.println(a + "~" + b + "范围内无水仙花数！");
	        }
	        // ---------------------End------------------------
	    }

	    // 判断一个数是否是水仙花数
	    public static boolean isNarcissistic(int num) {
	        if (num < 100 || num > 999) {
	            return false;
	        }
	        int x = num / 100;       // 百位
	        int y = (num / 10) % 10; // 十位
	        int z = num % 10;        // 个位
	        return num == x * x * x + y * y * y + z * z * z;
		
	}

}
